package com.heboan.code3;


/*
    上网套餐
*/
public class OnlinePackage extends PackageAbstract implements OnlineInterface {
    // 上网流量
    private int traffic;

    public OnlinePackage() {
    }

    public OnlinePackage(int traffic, double charge) {
        super(charge);
        this.traffic = traffic;
    }

    public int getTraffic() {
        return traffic;
    }

    public void setTraffic(int traffic){
        this.traffic = traffic;
    }

    @Override
    public void show(){
        System.out.println("上网套餐[" + "流量:" + getTraffic() + ",每月资费:" + getCharge() + "]");
    }

    @Override
    public void online(int traffic, SimCard simCard){
        System.out.println(simCard.getId() + "使用了" + traffic + "MB流量");
    }
}
